
//----------------------------------------------------------------
// Copyright (C) 2009 上海EZCRS
// 版权所有。 
// All rights reserved.

// 文件名：MsgAdapterConfigDAO.cs
// 文件功能描述：消息适配器配置
// 
// 
// 创建标识： kevin  2009-6-5 13:20:49
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Strive.Util.Text;
using Strive.Util.Logging;
using Strive.Core.Validations;
using Strive.Core.Service;
using Strive.Core.Translators;
using Strive.Util.Maths;
using Strive.Reflection;
using Strive.Aspects;
using Strive.Interface.IDataAccessBase.DAO;
using Strive.DataAccess.Base.Model.PageObject;
using Strive.DataAccess.Base.Model.SearcherObject;
using Strive.DataAccess;
using OTA.Notification.DAO.Adapter;
using OTA.Notification.Entity.Adapter;
using OTA.Notification.Interface.IDAO.Adapter;
using OTA.Notification.Interface.IBO.Adapter;

namespace OTA.Notification.DAO.Adapter
{
    /// <summary>
    /// MsgAdapterConfig的数据访问
    /// </summary>
	/// <exception cref=" DAOException">数据访问异常</exception>
	/// <exception cref="StriveException ">NStive框架异常</exception>
	/// <exception cref="Exception ">系统异常</exception>
	public class MsgAdapterConfigDao:BaseDAOBean<MsgAdapterConfigBean>, IMsgAdapterConfigDao
    {
        public MsgAdapterConfigDao() : base("notifyDB") { }

        #region IBaseDAOBean<MsgAdapterConfigBean>的实现

        /// <summary>
        /// 插入实体
        /// </summary>
        /// <param name="obj">MsgAdapterConfigBean</param>
        /// <returns>影响行数</returns>
		public int DataInsert(MsgAdapterConfigBean obj){
			return base.Insert(obj);
		}
		
		/// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="obj">MsgAdapterConfigBean</param>
        /// <returns>更新数目</returns>
		public int DataUpdate(MsgAdapterConfigBean obj){
			return base.Update(obj);
		}
		
		/// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="PK">MsgAdapterConfigBean</param>
        /// <returns>删除数目</returns>
        public int DataDelete(MsgAdapterConfigBean obj){
			return base.Delete(obj);
		}
		
		/// <summary>
        /// 根据PK得到实体,
        /// </summary>
        /// <param name="PK">PK</param>
        /// <returns>实体</returns>
        public MsgAdapterConfigBean DataSelect(string key){
			return base.GetObject(key);
		}


        public MsgAdapterConfigBean DataSelect(string key1, string key2)
        {
            IList<MsgAdapterConfigBean> list = base.QueryList(base.Query.Constrain("MsgSendTypeCode").Equal(key1).And().Constrain("ProtocolCode").Equal(key2));
            return (list != null && list.Count > 0) ? list[0] : null;
        }

		/// <summary>
        /// 获得所有实体
        /// </summary>
        /// <returns>实体集合</returns>
		/// <remarks>建议在一万数据以下使用该方法</remarks>
        public IList<MsgAdapterConfigBean> SelectAll(){
			return base.GetObjectList();
		}

		#endregion
		
		#region MsgAdapterConfigDao扩展
		
		/// <summary>
        /// 批量删除实体
        /// </summary>
        /// <param name="list">MsgAdapterConfigBean集合</param>
        /// <returns>删除数目</returns>
		public int DataDelete(IList<MsgAdapterConfigBean> list){
			return base.Delete(list);
		}
		
		/// <summary>
        /// 根据主键删除实体
        /// </summary>
        /// <param name="key">主键</param>
        /// <returns>删除数目</returns>
		public int DataDelete(string key){
            return base.Delete(base.Query.Constrain("MsgSendTypeCode").Equal(key));
		}
		
		/// <summary>
        /// 批量插入实体
        /// </summary>
        /// <param name="obj">MsgAdapterConfigBean集合</param>
        /// <returns>影响行数</returns>
		public int DataInsert(IList<MsgAdapterConfigBean> list){
			return base.Insert(list);
		}
		
		/// <summary>
        /// 批量更新实体
        /// </summary>
        /// <param name="obj">MsgAdapterConfigBean集合</param>
        /// <returns>更新数目</returns>
		public int DataUpdate(IList<MsgAdapterConfigBean> list){
			return base.Update(list);
		}
		
		/// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageObject">分页对象</param>
        /// <returns>集合</returns>
		/// <remarks>测试百万级数据在10秒内,比MSSQL2005分页性能要高</remarks>
		public PageResult<MsgAdapterConfigBean> SelectPageList(BasePageSearch pageObject){
			return base.QueryPageList(pageObject);
		}
		
		#endregion


       
    }
}

 